/*
 * Created on Dec 8, 2003
 *
 */
package org.vectrics.skill;

import org.apache.log4j.Logger;
import org.vectrics.SystemException;
import org.vectrics.user.Person;


public class UserSkillRating extends SkillRating {
	private String instanceCode = null;
	private UserEvaluation evaluation = null;
	private Person person = null;
	
	private transient static Logger log = Logger.getLogger(UserSkillRating.class);

	/**
	 * @return Returns the instanceCode.
	 */
	public String getInstanceCode() {
		return instanceCode;
	}

	public boolean hasSkill() {
		boolean result = false;
		if (this.getSkill().getScoringMethod().getCode().equals(SkillScoringMethod.SCORING_METHOD_YES_NO)) {
			if (this.getLevel().equals(Skill.LEVEL_YES)) 
				result = true;
		//} else if (this.getSkill().getScoringMethod().getCode().equals(SkillScoringMethod.SCORING_METHOD_YEARS)) {
		//	if (Integer.parseInt(this.getLevel()) > 0)
		//		result = true;
		} else if (this.getSkill().getScoringMethod().getCode().equals(SkillScoringMethod.SCORING_METHOD_LEVEL)) {
			if (Integer.parseInt(this.getLevel()) > 0)
				result = true;
		} else {
			throw new SystemException("Do not know how to handle scoring method: " 
					+ this.getSkillScoringLevel().getCaption());
		}
		return(result);
	}
	/**
	 * @param instanceCode The instanceCode to set.
	 */
	public void setInstanceCode(String instanceCode) {
		this.instanceCode = instanceCode;
	}

	/**
	 * @return Returns the evaluation.
	 */
	public UserEvaluation getEvaluation() {
		return evaluation;
	}
	/**
	 * @param evaluation The evaluation to set.
	 */
	public void setEvaluation(UserEvaluation evaluation) {
		this.evaluation = evaluation;
	}
	/**
	 * @return Returns the person.
	 */
	public Person getPerson() {
		return person;
	}
	/**
	 * @param person The person to set.
	 */
	public void setPerson(Person person) {
		this.person = person;
	}
}
